import { Tabs } from "antd";
import React from "react";
import { formatMessage } from 'umi-plugin-react/locale';
import RobotBasicSetting from "./robotBasicSetting";
import PolicySetting from "./policySetting";
import ScriptSetting from "./scriptSetting";
import styles from "../index.less"

class RobotSetting extends React.Component{
  constructor(props){
    super(props);
    this.state = {
      activeKey:"1"
    }
  }

  changeTab = activeKey => {
     this.setState({
      activeKey
     })
  }

  render(){
    const { activeKey } = this.state;
    const { applicationId,robotId } = this.props;

    return(
      <div className={styles.knowledge_configuration}>
        <Tabs activeKey={activeKey} onChange={this.changeTab}>
          <Tabs.TabPane tab={formatMessage({ id: 'robotSetting.basicConfig' })} key="1">
            {
              activeKey == 1 ? (
                <RobotBasicSetting applicationId={applicationId} />
              ) : ''
            }
          </Tabs.TabPane>
          <Tabs.TabPane tab={formatMessage({ id: 'robotSetting.policyConfig' })} key="2">
            {
              activeKey == 2 ? (
                <PolicySetting applicationId={applicationId} robotId={robotId} />
              ) : ''
            }
          </Tabs.TabPane>
        </Tabs>
      </div>
    )
  }
}

export default RobotSetting;